package cn.regexp.job.enums;

import java.util.concurrent.TimeUnit;

/**
 * @author Regexpei
 * @date 2024/7/5 22:51
 * @description 调度服务缓存key枚举
 */
public enum JobRedisKeyEnum {

    SECKILL_PRODUCT_LIST("seckillProductList:"), SECKILL_STOCK_COUNT_HASH("seckillStockCount:"), USER_HASH(
            "userHash"), USER_ZSET("userZset");

    private final String prefix;
    private TimeUnit unit;
    private int expireTime;

    JobRedisKeyEnum(String prefix, TimeUnit unit, int expireTime) {
        this.prefix = prefix;
        this.unit = unit;
        this.expireTime = expireTime;
    }

    JobRedisKeyEnum(String prefix) {
        this.prefix = prefix;
    }

    public String getRealKey(String key) {
        return this.prefix + key;
    }


}
